Skip to content

Fix for restoring nullness annotations from unbounded wildcard to captured type - #1717

Merged
msridhar merged 1 commit into
masterfrom
issue-1715
Aug 23, 2026
Merged

msridhar merged 1 commit into
masterfrom
issue-1715

Conversation

@msridhar

@msridhar msridhar commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1715

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of wildcard type captures when generic bounds are implicit or unbounded.
    • Prevented incorrect type compatibility results in cases involving dependent generic bounds and nullable types.
  • Tests

    • Added regression coverage for wildcard capture with generic interfaces and dependent bounds.

@msridhar

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e064bf5e-e717-49b1-b76b-c81aca512b66

📥 Commits

Reviewing files that changed from the base of the PR and between cf7c47d and 142ba54.

📒 Files selected for processing (2)
  • nullaway/src/main/java/com/uber/nullaway/generics/TypeSubstitutionUtils.java
  • nullaway/src/test/java/com/uber/nullaway/jspecify/WildcardTests.java

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

visitCapturedType now handles an extends capture paired with an unbounded wildcard by using the formal type variable’s upper bound. It safely handles missing variables and avoids rebuilding the wildcard when the bound is unchanged. A regression test covers dependent generic bounds, successful non-null retrieval, and the expected incompatibility diagnostic for nullable parameters.

Merge Risk: ⚪ Minimal · up to 142ba

This is a localized nullness-restoration fix with accompanying tests, and no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary fix for restoring nullness annotations from an unbounded wildcard to a captured type.
Linked Issues check ✅ Passed The implementation addresses issue #1715 by preventing the exception and adds a regression test for the reported generic wildcard scenario.
Out of Scope Changes check ✅ Passed The changes are limited to the targeted type-substitution fix and its regression test, with no unrelated scope identified.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-1715

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.78%. Comparing base (cf7c47d) to head (142ba54).

Files with missing lines Patch % Lines
.../uber/nullaway/generics/TypeSubstitutionUtils.java 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1717      +/-   ##
============================================
- Coverage     87.79%   87.78%   -0.01%     
  Complexity     3208     3208              
============================================
  Files           109      109              
  Lines         10898    10907       +9     
  Branches       2202     2205       +3     
============================================
+ Hits           9568     9575       +7     
- Misses          630      631       +1     
- Partials        700      701       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@msridhar
msridhar merged commit 8ccb49f into master Aug 23, 2026
5 of 10 checks passed
@msridhar
msridhar deleted the issue-1715 branch August 23, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception checking complicated generics and "var"

2 participants